package com.wc.AlgoOJ_homework.AlgoOJ_BL3.B_幸运数字;

/**
 * @Author congge
 * @Date 2024/4/4 9:20
 * @description http://43.138.190.70:8888/p/1083?tid=6602a77318e03a818a4bf04e
 */
public class Main {
    public static void main(String[] args) {
        int num = 0;
        int i = 0;
        while (i <= 2023) {
            num++;
            if (num % sum(num, 2) == 0 && num % sum(num, 8) == 0 && num % sum(num, 10) == 0 && num % sum(num, 16) == 0) {
                i++;
                System.out.println(i + " " + num);
            }
        }
    }

    static int sum(int num, int ra) {
        int res = 0;
        while (num > 0) {
            res += num % ra;
            num /= ra;
        }
        return res;
    }
}

